from Orange_lala import settings
from django.core.mail import send_mail


import os,django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Orange_lala.settings")# project_name 项目名称
django.setup()

def sent_maill(toemail,username,code):
    subject = "悦桔拉拉欢迎您"  # 邮件标题
    message = "how are you"   # 邮件正文
    sender = settings.EMAIL_FROM   # 发件人
    receiver = [toemail]  # 收件人
    # send_mail(subject, message, sender, receiver)
    html_message = """
         <h1>%s 欢迎您</h1><br/><h3>您的换绑邮箱验证码是 ： %s</h3><br/><h3>请您不要把验证码泄露给他人，以免造成您的财产损失</h3>
    <br/><h3>验证码1小时内有效，请您及时使用</h3>
    """  % (username,code)
    send_mail(subject, message, sender, receiver, html_message=html_message)


if __name__=='__main__':
    sent_maill('1668030512@qq.com','15615615','147258')